﻿package normal.test


import auth.sys.Auth
import com.alibaba.fastjson.JSON
import com.alibaba.fastjson.JSONObject
import com.alibaba.fastjson.TypeReference
import java.util.*


/**
 * @author futao
 * Created on 2017/11/30 - 9:43.
 */
val menuJson = "{\"mall\":{\"menu\":{\"name\":\"mall\",\"route\":\"mall\",\"moduleId\":\"menu/menu-mall\",\"nav\":true,\"title\":\"商城\",\"roleType\":\"1\"},\"menuMap\":{\"operation\":{\"id\":\"operation\",\"title\":\"运营管理\",\"items\":[{\"id\":\"mall-operation-summary\",\"href\":\"#mall-operation-summary\",\"title\":\"商城概览\",\"icon\":\"fa-paper-plane\",\"style\":\"\",\"line\":false,\"hide\":false,\"roleType\":\"1\"},{\"id\":\"mall-operation-setting\",\"href\":\"#mall-operation-setting\",\"moduleId\":\"mall/operation/setting\",\"title\":\"商城设置\",\"icon\":\"fa-cog\"},{\"id\":\"mall-operation-subjects\",\"href\":\"#mall-operation-subjects\",\"moduleId\":\"mall/operation/subjects\",\"icon\":\"fa-calendar-o\",\"title\":\"活动专题\"},{\"id\":\"mall-operation-searchTerms\",\"href\":\"#mall-operation-searchTerms\",\"moduleId\":\"mall/operation/searchTerms\",\"icon\":\" fa-search\",\"title\":\"搜索关键词\"}],\"line\":false,\"href\":\"#operation\",\"hide\":false,\"roleType\":\"1\",\"style\":\"\"},\"goods\":{\"id\":\"goods\",\"title\":\"商品管理\",\"icon\":\"fa-building\",\"items\":[{\"id\":\"mall-goods-detail\",\"href\":\"#mall-goods-detail\",\"moduleId\":\"mall/goods/detail\",\"title\":\"商品发布\",\"style\":\"btn\"},{\"id\":\"mall-goods-sales\",\"href\":\"#mall-goods-sales\",\"moduleId\":\"mall/goods/sales\",\"title\":\"出售中的商品\",\"icon\":\"fa-black-tie\"},{\"id\":\"mall-goods-outsales\",\"href\":\"#mall-goods-outsales\",\"moduleId\":\"mall/goods/outsales\",\"title\":\"仓库中的商品\",\"icon\":\"fa-cubes\",\"line\":true},{\"id\":\"mall-goods-group\",\"href\":\"#mall-goods-group\",\"moduleId\":\"mall/goods/group/groups\",\"title\":\"分组管理\",\"icon\":\"fa-clone\"},{\"id\":\"mall-goods-prop\",\"href\":\"#mall-goods-prop\",\"moduleId\":\"mall/goods/prop/props\",\"title\":\"属性规格\",\"icon\":\"fa-bars\"},{\"id\":\"mall-goods-freight\",\"href\":\"#mall-goods-freight\",\"moduleId\":\"mall/goods/freight/templates\",\"title\":\"运费模板\",\"icon\":\"fa-cube\"},{\"id\":\"mall-goods-tags\",\"href\":\"#mall-goods-tags\",\"moduleId\":\"mall/goods/tag/tags\",\"title\":\"标签管理\",\"icon\":\"fa-tags\"}]},\"shop\":{\"id\":\"shop\",\"title\":\"订单管理\",\"icon\":\"fa-cart-plus\",\"items\":[{\"id\":\"mall-shop-ordersList\",\"href\":\"#mall-shop-ordersList\",\"moduleId\":\"mall/shop/order/ordersList\",\"icon\":\"fa-outdent\",\"role\":[3],\"title\":\"订单列表\"},{\"id\":\"mall-shop-toSendGoods\",\"href\":\"#mall-shop-toSendGoods\",\"moduleId\":\"mall/shop/order/toSendGoods\",\"icon\":\"fa-cubes\",\"hide\":true,\"title\":\"待发货\"},{\"id\":\"mall-shop-reviewManage\",\"href\":\"#mall-shop-reviewManage\",\"moduleId\":\"mall/shop/review/reviewManage\",\"icon\":\"fa-commenting\",\"role\":[3],\"title\":\"评价管理\"},{\"id\":\"mall-shop-order-export\",\"href\":\"#mall-shop-order-export\",\"moduleId\":\"mall/shop/order/export\",\"icon\":\"fa-commenting\",\"role\":[3],\"title\":\"导出\"}]},\"decorate\":{\"id\":\"decorate\",\"title\":\"页面装修\",\"hide\":true,\"icon\":\"fa-th\",\"items\":[{\"id\":\"mall-decorate-index\",\"href\":\"#mall-decorate-index\",\"moduleId\":\"mall/decorate/mall-index\",\"title\":\"首页装修\",\"icon\":\"fa-calendar-minus-o\"},{\"id\":\"mall-decorate-banner\",\"href\":\"#mall-decorate-banner\",\"moduleId\":\"mall/decorate/banner\",\"title\":\"广告位装修\",\"hide\":true,\"icon\":\"fa-calendar-minus-o\"},{\"id\":\"mall-decorate-product-list\",\"href\":\"#mall-decorate-product-list\",\"moduleId\":\"mall/decorate/product-list\",\"title\":\"商品列表\",\"icon\":\"fa-calendar-minus-o\"},{\"id\":\"mall-decorate-product-detail\",\"href\":\"#mall-decorate-product-detail\",\"moduleId\":\"mall/decorate/product-detail\",\"title\":\"商品详情\",\"icon\":\"fa-calendar-minus-o\"},{\"id\":\"mall-decorate-user-center\",\"href\":\"#mall-decorate-user-center\",\"moduleId\":\"mall/decorate/user-center\",\"title\":\"用户中心\",\"icon\":\"fa-calendar-minus-o\"},{\"id\":\"mall-decorate-footer-index\",\"href\":\"#mall-decorate-footer-index\",\"moduleId\":\"mall/decorate/footer-index\",\"title\":\"底部装修\",\"icon\":\"fa-calendar-minus-o\"}]},\"manage-resources\":{\"id\":\"manage-resources\",\"href\":\"#manage-resources\",\"moduleId\":\"manage/resources\",\"title\":\"资源空间\",\"icon\":\"fa-image\"}}},\"marketing\":{\"menu\":{\"route\":\"marketing\",\"name\":\"marketing\",\"moduleId\":\"menu/menu-marketing\",\"nav\":true,\"role\":[3],\"title\":\"营销\"},\"menuMap\":{\"discount\":{\"id\":\"discount\",\"title\":\"促销\",\"items\":[{\"id\":\"marketing-discount-discounts\",\"href\":\"#marketing-discount-discounts\",\"moduleId\":\"marketing/discount/discounts\",\"icon\":\"fa-credit-card\",\"title\":\"优惠券\"}]}}},\"manage\":{\"menu\":{\"name\":\"manage\",\"route\":\"manage\",\"moduleId\":\"menu/menu-manage\",\"nav\":true,\"title\":\"系统管理\",\"roleType\":\"1\"},\"menuMap\":{\"shops\":{\"id\":\"manage-shops\",\"href\":\"#manage-shops\",\"moduleId\":\"manage/shops\",\"icon\":\"fa-address-card-o\",\"title\":\"商家管理\"},\"category\":{\"id\":\"manage-category\",\"href\":\"#manage-category\",\"moduleId\":\"manage/category\",\"icon\":\"fa-bars\",\"title\":\"类别管理\"},\"roles-setting\":{\"id\":\"roles-setting\",\"href\":\"#manage-roles-setting\",\"moduleId\":\"manage/roles\",\"icon\":\"fa-address-card-o\",\"title\":\"角色管理\"},\"menus-setting\":{\"id\":\"menus-setting\",\"href\":\"#manage-menus-setting\",\"moduleId\":\"manage/menus-setting\",\"icon\":\"fa-address-card-o\",\"title\":\"菜单管理\"},\"stuff\":{\"id\":\"manage-stuff\",\"href\":\"#manage-stuff\",\"moduleId\":\"manage/stuff\",\"icon\":\"fa-calendar-minus-o\",\"title\":\"员工列表\"},\"caches\":{\"id\":\"manage-caches\",\"href\":\"#manage-caches\",\"moduleId\":\"manage/caches\",\"icon\":\"fa-database\",\"title\":\"缓存管理\"}}},\"member\":{\"menu\":{\"name\":\"member\",\"route\":\"member\",\"moduleId\":\"menu/menu-member\",\"nav\":true,\"title\":\"会员\",\"roleType\":\"2\"},\"menuMap\":{\"member\":{\"id\":\"member\",\"title\":\"会员管理\",\"icon\":\"fa-users\",\"items\":[{\"id\":\"integral-management\",\"href\":\"integral-management\",\"moduleId\":\"member/integral-management\",\"title\":\"积分设置\",\"icon\":\"fa-star-o\"},{\"id\":\"grade-management\",\"href\":\"grade-management\",\"moduleId\":\"member/grade-management\",\"title\":\"等级设置\",\"icon\":\"fa-sliders\"},{\"id\":\"member-management\",\"href\":\"member-management\",\"moduleId\":\"member/member-manage\",\"title\":\"会员管理\",\"icon\":\"fa-user-circle\"}]}}},\"sales\":{\"menu\":{\"route\":\"sales\",\"name\":\"sales\",\"moduleId\":\"menu/menu-sales\",\"nav\":true,\"role\":[4,5],\"title\":\"销售\"},\"menuMap\":{\"goods-pick\":{\"id\":\"goods-pick\",\"moduleId\":\"sales-manage/goods/pick\",\"href\":\"#goods-pick\",\"role\":[4],\"title\":\"提货\"},\"refund-good\":{\"id\":\"mall-shop-orderRefund\",\"href\":\"#mall-shop-orderRefund\",\"moduleId\":\"mall/shop/order/ordersRefundList\",\"icon\":\"fa-commenting\",\"title\":\"退货\"}}},\"setting\":{\"menu\":{\"route\":\"setting\",\"name\":\"setting\",\"moduleId\":\"menu/menu-setting\",\"nav\":true,\"title\":\"设置\"},\"menuMap\":{\"changePwd\":{\"id\":\"changePwd\",\"title\":\"修改密码\",\"href\":\"#setting/changePwd\",\"moduleId\":\"setting/changePwd\",\"icon\":\"fa-cog\",\"line\":true},\"logout\":{\"id\":\"logout\",\"title\":\"退出登录\",\"href\":\"#setting/logout\",\"icon\":\"fa-power-off\"}}},\"test\":{\"menu\":{\"name\":\"test\",\"route\":\"test\",\"moduleId\":\"menu/menu-test\",\"nav\":true,\"title\":\"测试\",\"roleType\":\"1\"},\"menuMap\":{\"test\":{\"id\":\"test\",\"moduleId\":\"test/test\",\"href\":\"#test\",\"title\":\"测试\"},\"test-sub\":{\"id\":\"test-two-menu\",\"title\":\"二级菜单\",\"items\":[{\"id\":\"test-chart\",\"href\":\"#test-chart\",\"moduleId\":\"test/chart-test\",\"title\":\"testChart\"},{\"id\":\"test-sub1\",\"href\":\"#test-sub1\",\"moduleId\":\"test/test\",\"title\":\"testSub1\"},{\"id\":\"test-sub2\",\"href\":\"#test-sub2\",\"moduleId\":\"test/test-sub2\",\"title\":\"testSub2\"}]}}}}"


val authJson = "{\"mall\":{\"menu\":{\"name\":\"mall\",\"title\":\"商城\",\"auth\":[{\"key\":\"show\",\"title\":\"显示\",\"val\":true}]},\"menuMap\":{\"operation\":{\"id\":\"operation\",\"title\":\"运营管理\",\"items\":[{\"id\":\"mall-operation-summary\",\"title\":\"商城概览\",\"roleType\":\"1\",\"auth\":[{\"key\":\"show\",\"title\":\"显示\",\"val\":false}]},{\"id\":\"mall-operation-setting\",\"title\":\"商城设置\",\"auth\":[{\"key\":\"show\",\"title\":\"显示\",\"val\":false}]},{\"id\":\"mall-operation-subjects\",\"title\":\"活动专题\",\"auth\":[{\"key\":\"show\",\"title\":\"显示\",\"val\":false}]},{\"id\":\"mall-operation-searchTerms\",\"title\":\"搜索关键词\",\"auth\":[{\"key\":\"show\",\"title\":\"显示\",\"val\":false}]}],\"roleType\":\"1\",\"auth\":[{\"key\":\"show\",\"title\":\"显示\",\"val\":false}]},\"goods\":{\"id\":\"goods\",\"title\":\"商品管理\",\"items\":[{\"id\":\"mall-goods-detail\",\"title\":\"商品发布\",\"auth\":[{\"key\":\"show\",\"title\":\"显示\",\"val\":true}]},{\"id\":\"mall-goods-sales\",\"title\":\"出售中的商品\",\"auth\":[{\"key\":\"show\",\"title\":\"显示\",\"val\":true}]},{\"id\":\"mall-goods-outsales\",\"title\":\"仓库中的商品\",\"auth\":[{\"key\":\"show\",\"title\":\"显示\",\"val\":true}]},{\"id\":\"mall-goods-group\",\"title\":\"分组管理\",\"auth\":[{\"key\":\"show\",\"title\":\"显示\",\"val\":true}]},{\"id\":\"mall-goods-prop\",\"title\":\"属性规格\",\"auth\":[{\"key\":\"show\",\"title\":\"显示\",\"val\":true}]},{\"id\":\"mall-goods-freight\",\"title\":\"运费模板\",\"auth\":[{\"key\":\"show\",\"title\":\"显示\",\"val\":true}]},{\"id\":\"mall-goods-tags\",\"title\":\"标签管理\",\"auth\":[{\"key\":\"show\",\"title\":\"显示\",\"val\":true}]}],\"auth\":[{\"key\":\"show\",\"title\":\"显示\",\"val\":true}]},\"shop\":{\"id\":\"shop\",\"title\":\"订单管理\",\"items\":[{\"id\":\"mall-shop-ordersList\",\"title\":\"订单列表\",\"auth\":[{\"key\":\"show\",\"title\":\"显示\",\"val\":true}]},{\"id\":\"mall-shop-toSendGoods\",\"title\":\"待发货\",\"auth\":[{\"key\":\"show\",\"title\":\"显示\",\"val\":true}]},{\"id\":\"mall-shop-reviewManage\",\"title\":\"评价管理\",\"auth\":[{\"key\":\"show\",\"title\":\"显示\",\"val\":true}]},{\"id\":\"mall-shop-order-export\",\"title\":\"导出\",\"auth\":[{\"key\":\"show\",\"title\":\"显示\",\"val\":true}]}],\"auth\":[{\"key\":\"show\",\"title\":\"显示\",\"val\":true}]},\"decorate\":{\"id\":\"decorate\",\"title\":\"页面装修\",\"items\":[{\"id\":\"mall-decorate-index\",\"title\":\"首页装修\",\"auth\":[{\"key\":\"show\",\"title\":\"显示\",\"val\":true}]},{\"id\":\"mall-decorate-banner\",\"title\":\"广告位装修\",\"auth\":[{\"key\":\"show\",\"title\":\"显示\",\"val\":true}]},{\"id\":\"mall-decorate-product-list\",\"title\":\"商品列表\",\"auth\":[{\"key\":\"show\",\"title\":\"显示\",\"val\":true}]},{\"id\":\"mall-decorate-product-detail\",\"title\":\"商品详情\",\"auth\":[{\"key\":\"show\",\"title\":\"显示\",\"val\":true}]},{\"id\":\"mall-decorate-user-center\",\"title\":\"用户中心\",\"auth\":[{\"key\":\"show\",\"title\":\"显示\",\"val\":true}]},{\"id\":\"mall-decorate-footer-index\",\"title\":\"底部装修\",\"auth\":[{\"key\":\"show\",\"title\":\"显示\",\"val\":true}]}],\"auth\":[{\"key\":\"show\",\"title\":\"显示\",\"val\":true}]},\"manage-resources\":{\"id\":\"manage-resources\",\"title\":\"资源空间\",\"auth\":[{\"key\":\"show\",\"title\":\"显示\",\"val\":true}]}}},\"marketing\":{\"menu\":{\"name\":\"marketing\",\"title\":\"营销\",\"auth\":[{\"key\":\"show\",\"title\":\"显示\",\"val\":true}]},\"menuMap\":{\"discount\":{\"id\":\"discount\",\"title\":\"促销\",\"items\":[{\"id\":\"marketing-discount-discounts\",\"title\":\"优惠券\",\"auth\":[{\"key\":\"show\",\"title\":\"显示\",\"val\":true}]}],\"auth\":[{\"key\":\"show\",\"title\":\"显示\",\"val\":true}]}}},\"manage\":{\"menu\":{\"name\":\"manage\",\"title\":\"系统管理\",\"roleType\":\"1\",\"auth\":[{\"key\":\"show\",\"title\":\"显示\",\"val\":false}]},\"menuMap\":{\"shops\":{\"id\":\"manage-shops\",\"title\":\"商家管理\",\"auth\":[{\"key\":\"show\",\"title\":\"显示\",\"val\":false}]},\"category\":{\"id\":\"manage-category\",\"title\":\"类别管理\",\"auth\":[{\"key\":\"show\",\"title\":\"显示\",\"val\":false}]},\"roles-setting\":{\"id\":\"roles-setting\",\"title\":\"角色管理\",\"auth\":[{\"key\":\"show\",\"title\":\"显示\",\"val\":false}]},\"menus-setting\":{\"id\":\"menus-setting\",\"title\":\"菜单管理\",\"auth\":[{\"key\":\"show\",\"title\":\"显示\",\"val\":false}]},\"stuff\":{\"id\":\"manage-stuff\",\"title\":\"员工列表\",\"auth\":[{\"key\":\"show\",\"title\":\"显示\",\"val\":false}]},\"caches\":{\"id\":\"manage-caches\",\"title\":\"缓存管理\",\"auth\":[{\"key\":\"show\",\"title\":\"显示\",\"val\":false}]}}},\"member\":{\"menu\":{\"name\":\"member\",\"title\":\"会员\",\"roleType\":\"1\",\"auth\":[{\"key\":\"show\",\"title\":\"显示\",\"val\":false}]},\"menuMap\":{\"member\":{\"id\":\"member\",\"title\":\"会员管理\",\"items\":[{\"id\":\"integral-management\",\"title\":\"积分设置\",\"auth\":[{\"key\":\"show\",\"title\":\"显示\",\"val\":false}]},{\"id\":\"grade-management\",\"title\":\"等级设置\",\"auth\":[{\"key\":\"show\",\"title\":\"显示\",\"val\":false}]},{\"id\":\"member-management\",\"title\":\"会员管理\",\"auth\":[{\"key\":\"show\",\"title\":\"显示\",\"val\":false}]}],\"auth\":[{\"key\":\"show\",\"title\":\"显示\",\"val\":false}]}}},\"sales\":{\"menu\":{\"name\":\"sales\",\"title\":\"销售\",\"auth\":[{\"key\":\"show\",\"title\":\"显示\",\"val\":false}]},\"menuMap\":{\"goods-pick\":{\"id\":\"goods-pick\",\"title\":\"提货\",\"auth\":[{\"key\":\"show\",\"title\":\"显示\",\"val\":true}]},\"refund-good\":{\"id\":\"mall-shop-orderRefund\",\"title\":\"退货\",\"auth\":[{\"key\":\"show\",\"title\":\"显示\",\"val\":true}]}}},\"setting\":{\"menu\":{\"name\":\"setting\",\"title\":\"设置\",\"auth\":[{\"key\":\"show\",\"title\":\"显示\",\"val\":true}]},\"menuMap\":{\"changePwd\":{\"id\":\"changePwd\",\"title\":\"修改密码\",\"auth\":[{\"key\":\"show\",\"title\":\"显示\",\"val\":true}]},\"logout\":{\"id\":\"logout\",\"title\":\"退出登录\",\"auth\":[{\"key\":\"show\",\"title\":\"显示\",\"val\":true}]}}},\"test\":{\"menu\":{\"name\":\"test\",\"title\":\"测试\",\"auth\":[{\"key\":\"show\",\"title\":\"显示\",\"val\":false}]},\"menuMap\":{\"test\":{\"id\":\"test\",\"title\":\"测试\",\"auth\":[{\"key\":\"show\",\"title\":\"显示\",\"val\":false}]},\"test-sub\":{\"id\":\"test-two-menu\",\"title\":\"二级菜单\",\"items\":[{\"id\":\"test-chart\",\"title\":\"testChart\",\"auth\":[{\"key\":\"show\",\"title\":\"显示\",\"val\":false}]},{\"id\":\"test-sub1\",\"title\":\"testSub1\",\"auth\":[{\"key\":\"show\",\"title\":\"显示\",\"val\":false}]},{\"id\":\"test-sub2\",\"title\":\"testSub2\",\"auth\":[{\"key\":\"show\",\"title\":\"显示\",\"val\":false}]}],\"auth\":[{\"key\":\"show\",\"title\":\"显示\",\"val\":false}]}}}}"


/**
 * fastJson在把json格式的字符串转换成JSONObject的时候，使用的是HashMap，所以排序规则是根据HASH值排序的，如果想要按照字符串顺序遍历JSON属性,需要在转换的时候指定使用LinkedHashMap代替HashMap。
 */
inline fun fastJsonParseObject(data: String): LinkedHashMap<String, String> {
    return JSON.parseObject(data, object : TypeReference<LinkedHashMap<String, String>>() {})
}

/**
 * show
 */
val authShow = Auth().apply {
    key = "show"
    title = "显示"
    isVal = true
}
/**
 * View
 */
val authView = Auth().apply {
    key = "view"
    title = "查看"
    isVal = true
}
/**
 * add
 */
val authAdd = Auth().apply {
    key = "add"
    title = "添加"
    isVal = true
}
/**
 * update
 */
val authUpdate = Auth().apply {
    key = "update"
    title = "修改"
    isVal = true
}
/**
 * delete
 */
val authDelete = Auth().apply {
    key = "delete"
    title = "删除"
    isVal = true
}